package com.atguigu.gmall.realtime.apps

import com.atguigu.gmall.contants.GmallConstants
import com.atguigu.gmall.realtime.utils.{MykafkaUtil, PropertiesUtil}
import org.apache.spark.SparkContext
import org.apache.spark.streaming.{Seconds, StreamingContext}

/**
 * Date:2021/3/17
 * Author:csw
 * Description:
 */
abstract class BaseApp {

  val appName:String
  val seound:Int
  var ssc: StreamingContext=null

  def runApp(op : =>Unit) ={

    ssc= new StreamingContext("local[*]", appName, Seconds(seound))
    try{
      op
    }catch {
      case  e:Exception=>e.printStackTrace()
    }
    ssc.start()
    ssc.awaitTermination()
  }
}
